// pages/view/mt/deptMedicalWork/deptMedicalWork.js
const network = require('../../../../utils/network.js')
var app = getApp();
var startTime_n;
var endTime_n;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //table数据list
      medicalWorkList:[],
    headers: [{ text: 'deptName', display: '' }, { text: 'jcTimes', display: '' }, { text: 'jcAmount', display: '' }, { text: 'jcAvgAmount', display: '' }, { text: 'hyTimes', display: '' }, { text: 'hyAmount', display: '' }, { text: 'hyAvgAmount', display: '' }],
    row: [],

    jcTimes: "",
    jcAmount: "",
    jcAvgAmount: "",
    hyTimes: "",
    hyAmount: "",
    hyAvgAmount: "",
  },

  /**
     * 生命周期函数--监听页面加载
     */
  onLoad: function (options) {
    var that = this
    wx.showLoading({
      title: '加载中',
    })
    that.myRequest(options)
    
  },
  /**
 * 调用封装好的网络请求，获取数据
 */
  myRequest: function (options) {

    var that = this
    console.log('options:', options)
    //调用封装好的网络请求，获取数据//options.startTime + '&endTime=' + options.endTime
    network.get('/mt/deptwork?startTime=' + '2018-01-01' + '&endTime=' + '2018-01-30', {})
      .then(function (res) {
        console.log('res:', res)

        that.setData({

          startTime: startTime_n,
          endTime: endTime_n,
          row: res.data.data,

          jcTimes: res.data.data.list3.jcTimes,
          jcAmount: res.data.data.list3.jcAmount,
          jcAvgAmount: res.data.data.list3.jcAvgAmount,
          hyTimes: res.data.data.list3.hyTimes,
          hyAmount: res.data.data.list3.hyAmount,
          hyAvgAmount: res.data.data.list3.hyAvgAmount,

        })


      }).then(function (res) {
        wx.hideLoading()
      }).catch(function (res) {
        console.log(res)
      })
  },
})